//
//  MoreHeaderView.m
//  DaoZiJinFu
//
//  Created by woker on 16/6/28.
//  Copyright © 2016年 iwoker. All rights reserved.
//

#import "MoreHeaderView.h"

@implementation MoreHeaderView

+ (instancetype)loadView {
    return [[[NSBundle mainBundle] loadNibNamed:@"MoreHeaderView" owner:nil options:nil] lastObject];
}

- (IBAction)userTitleClick:(id)sender {
    if (userValue(ISLOGIN) == nil) {
        [theUser setObject:[NSNumber numberWithBool:NO] forKey:ISLOGIN];
        [theUser synchronize];
    }
    if ([userValue(ISLOGIN) boolValue] == NO) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"registerOperation" object:self];
    } else {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"skipToUserInfo" object:self];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    if ([userValue(ISLOGIN) boolValue] == YES) {
        [_userTitleBtn setTitle:DZUserInfo.userInfo.head_img_name forState:UIControlStateNormal];
    } else {
        [_userTitleBtn setTitle:@"登录 | 注册" forState:UIControlStateNormal];
    }
}

@end
